@import './abstracts/variable';
@import './abstracts/mixin';
@import './icon.scss';

@include b(search) {
  display: flex;
  padding: $-search-padding;
  align-items: center;
  background: #fff;

  @include e(block) {
    position: relative;
    flex: 1;
    background-color: $-search-input-bg;
    border-radius: $-search-input-radius;
  }
  @include e(input) {
    display: block;
    width: 100%;
    height: $-search-input-height;
    border-radius: $-search-input-radius;
    box-sizing: border-box;
    padding: $-search-input-padding;
    border: none;
    line-height: $-search-input-height;
    background: transparent;
    font-size: $-search-input-fs;
    -webkit-appearance: none;
    outline: none;
    color: $-search-input-color;
    -webkit-tap-highlight-color: transparent;

    @include lineEllipsis;

    &::-webkit-search-cancel-button{
      -webkit-appearance: none;
    }
  }
  @include e(placeholder) {
    position: absolute;
    width: 100%;
    height: 100%;
    line-height: $-search-input-height;
    left: 0;
    top: 0;
    text-align: center;
    font-size: 0;

    @include when(focus) {
      left: 10px;
      text-align: left;
    }
  }
  @include e(search-icon) {
    display: inline-block;
    color: $-search-icon-color;
    vertical-align: middle;
    font-size: $-search-input-fs;
  }
  @include e(placeholder-txt) {
    display: inline-block;
    margin-left: 10px;
    color: $-search-placeholder-color;
    font-size: $-search-input-fs;
    vertical-align: middle;
  }
  @include e(clear) {
    position: absolute;
    padding: 4px;
    right: 12px;
    top: 50%;
    transform: translate(0, -50%);
    font-size: $-search-input-fs;
    color: $-search-icon-color;
    -webkit-tap-highlight-color: transparent;
  }
  @include e(cancel) {
    padding: $-search-cancel-padding;
    height: $-search-input-height;
    line-height: $-search-input-height;
    font-size: $-search-input-fs;
    color: $-search-cancel-color;
    -webkit-tap-highlight-color: transparent;
  }
  @include when(light) {
    background: $-search-light-bg;

    .wd-search__block {
      background: #fff;
    }
  }
  @include when(without-cancel) {
    padding-right: $-search-side-padding;
  }
}